package com.woniu.sharepark.common;

/**
 * @ClassName: JsonResult
 * @Description: 该类用于存放返回的Json数据
 * @Author: Zongjie.Li
 * @Date: 2019/6/3
 * @Version: 1.0
 **/
public class JsonResult {
    private String msg;
    private Integer code;
    private Object result;

    public JsonResult() {
    }

    public JsonResult(String msg, Integer code, Object result) {
        this.msg = msg;
        this.code = code;
        this.result = result;
    }

    public JsonResult(String msg, Integer code) {
        this.msg = msg;
        this.code = code;
    }

    public JsonResult(String msg) {
        this.msg = msg;
    }

    public JsonResult(Integer code) {
        this.code = code;
    }
    public static JsonResult ok(String msg){
        return new JsonResult(msg,200);
    }
    public static JsonResult ok(){
        return new JsonResult(200);
    }
    public static JsonResult ok(String msg,Object result){
        return new JsonResult(msg,200,result);
    }

    public static JsonResult error(){
        return new JsonResult(500);
    }
    public static JsonResult error(String msg){
        return new JsonResult(msg,500);
    }

    public static JsonResult error(String msg,Object result){
        return new JsonResult(msg,500,result);
    }

    public JsonResult(Object result) {
        this.result = result;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }


}
